/**
 * 
 */
package com.feib.stms.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.feib.stms.dao.UserLoginControlDao;
import com.feib.stms.model.User;
import com.feib.stms.model.UserLoginControl;
import com.feib.stms.service.UserLoginControlService;

/**
 * @author Jimmy Liu
 *
 */
@Service("userLoginControlService")
public class UserLoginControlServiceImpl extends BaseServiceImpl implements UserLoginControlService 
{
	private static final long serialVersionUID = -7332915481526239732L;
	
	@Resource(name="userLoginControlDao")
    private UserLoginControlDao userLoginControlDao;
	
	
	public int saveUserLoginControl(UserLoginControl userLoginControl) 
	{
		int result = 0;
		if (null == userLoginControl.getUserLoginControlPk())
		{
			// 新增
			result = userLoginControlDao.insert(userLoginControl);
		}
		else
		{
			// 更新
			result = userLoginControlDao.update(userLoginControl);
		}
		return result;
	}
	
	public UserLoginControl findByUerIdGroupNo(User user) {
		return userLoginControlDao.getByUerIdGroupNo(user);
	}
	
	public int logout(UserLoginControl userLoginControl) {
		return userLoginControlDao.updateActived(userLoginControl);
	}

}
